<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="../css/app.css"/>
    <link type="text/css" rel="stylesheet" href="../css/loginMobile.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../datepicker/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/pc/js/all.js"></script>
</head>
<body id="Ibody">
<!--
	制作：陈道祥
	页面：员工企业信息2
	更新：九哥
-->





<!-----------公司员工信息2页面---------->
<div class="stepTwo" id="IstepSixCompanyEmployeeInfoTwo">
    <div id="IemployeeEduListCompany">
        <div class="modelPanel">
            <div class="modelTile">教育背景</div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请选择起始日期" class="regCode regInput"
                       readonly name="dataPluginEduCompany" id="eduBgStart01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请选择截止日期" class="regCode regInput"
                       readonly name="dataPluginEduCompany" id="eduBgEnd01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入毕业院校"
                       class="regCode" id="eduBgSchool01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入专业"
                       class="regCode" id="eduBgMajor01">
            </div>
            <div class="bossInfoDiv">
                <textarea class="factoryIntro" placeholder="所获奖项"
                          id="eduBgAward01"></textarea>
            </div>
        </div>
    </div>
    <div class="addMore none" onclick="addEduBg()">添加更多教育背景</div>
    <div class="companyInfoSpace"></div>
    <div id="IemployeeJobListCompany">
        <div class="modelPanel">
            <div class="modelTile">工作经历</div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请选择起始日期" class="regCode regInput"
                       readonly name="dataPluginJobCompany" id="workStart01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请选择截止日期" class="regCode regInput"
                       readonly name="dataPluginJobCompany" id="workEnd01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入公司名称"
                       class="regCode" id="workComName01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入职位"
                       class="regCode" id="workJob01">
            </div>
            <div class="businessTitle">离职原因：</div>
            <div class="factoryIntroDiv">
                <textarea class="factoryIntro" id="workLeave01"></textarea>
            </div>
        </div>
    </div>
    <div class="addMore none" onclick="addWork()">添加更多工作经历</div>
    <div class="companyInfoSpace"></div>
    <div id="IemployeeFamilyListCompany">
        <div class="modelPanel">
            <div class="modelTile">家庭成员</div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入姓名"
                       class="regCode" id="familyName01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入称谓"
                       class="regCode" id="familyCall01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入工作单位"
                       class="regCode" id="familyCom01">
            </div>
            <div class="bossInfoDiv">
                <input type="text" placeholder="请输入联系电话"
                       class="regCode" id="familyContact01">
            </div>
        </div>
    </div>
    <div class="addMore none" onclick="addFamily()">添加更多家庭成员</div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="modelTile">自我评价</div>
        <div class="businessTitle">自我能力评价：</div>
        <div class="factoryIntroDiv">
            <textarea placeholder="请填写对自己的简评，说明个人优势，限1000字" class="factoryIntro" id="comFeature"></textarea>
        </div>
        <div class="businessTitle">自我擅长技能评价：</div>
        <div class="factoryIntroDiv">
            <textarea placeholder="请填写对自己的简评，说明个人优势，限1000字" class="factoryIntro" id="comSkill"></textarea>
        </div>
        <div class="businessTitle">自我爱好特长：</div>
        <div class="factoryIntroDiv">
            <textarea placeholder="请填写对自己的简评，说明个人优势，限1000字" class="factoryIntro" id="comHobby"></textarea>
        </div>
        <div class="businessTitle">员工对工厂期待：</div>
        <div class="factoryIntroDiv">
            <textarea placeholder="请填写对自己的简评，说明个人优势，限1000字" class="factoryIntro" id="comExpect"></textarea>
        </div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="modelTile">人才需求</div>
        <div class="businessTitle">业务类型：</div>
        <div class="businessItemDiv" id="businessRadio">
        </div>
        <div class="businessTitle">技术等级：</div>
        <div class="businessItemDiv" id="skillRadio">
        </div>
        <br><br><br>
    </div>
    <div class="stopFloat"></div>
    <div class="companyInfoSpace"></div>
    <div class="companyRemark">备注：方便你的客户找到你、招聘的员工找到你、了解你、信任你，图片尽量上传完善。让客户多了解自己，容易接单成功。细节决定成败，图片清晰。</div>
    <div class="nextStepDiv">
        <span class="prevStep" onclick="history.go(-1)">返回</span>
        <!--<span class="nextStep" id="staffInfo2Next">下一步</span>-->
        <span class="nextStep" onclick="setSave()">保存</span>
    </div>
    
    <script>
            $('.regInput').datepicker({
                    dateFormat : "yy-mm-dd",
                    dayNamesMin : [ "一", "二", "三", "四", "五", "六", "日" ],
                    monthNamesShort : ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                    changeMonth : true,
                    changeYear : true,
                    firstDay : 0,
                    prevText : '上月',
                    nextText : '下月'
                });
       </script>
</div>
<input type="hidden" id="businessRadioInput" value="0">
<input type="hidden" id="skillRadioInput" value="0">
<input type="hidden" id="eduBgCount" value="1"><!--教育背景个数-->
<input type="hidden" id="workCount" value="1"><!--工作经历个数-->
<input type="hidden" id="familyCount" value="1"><!--家庭成员个数-->
<!-----------公司员工信息2页面---------->





<!-----------提示信息---------->
<div id="errMsg"></div>
<!-----------提示信息---------->
</body>
<script type="text/javascript" src="../js/loginStaff.js"></script>
<script>
    (function(){
        getStaffInfo2();
    })();
    /**
     * 员工资料2，获取
     * */
    function getStaffInfo2() {
        var userInfo = cacheGet('userInfo'); //获取用户信息
        var staffOption = cacheGet('staffOption'); //获取用户可选资料
        if (userInfo == null || userInfo.token == 'undefined') {
            getErrMsg('没有登录！');
            return;
        }
        var data = {
            app_access: app_access,
            token: userInfo.token,
            type: userInfo.type,
            cate: userInfo.cate
        };
        var business = 0, skill = 0;
        var i, i2, i3;
        $.ajax({
            type: 'post',
            url: getDomain() + 'staff/show2',
            data: data,
            success: function (res) {
                //console.log(res); return;
                if (res.code != 0) {
                    getRadioList(0, 0);
                    console.log(res);
                    return;
                }
                console.log(res.data);
                //教育背景
                for (i = 1; i <= res.data.eduBgs.eduBgCount; i++) {
                    if($('#eduBgStart0' + i)[0]){
                    $('#eduBgStart0' + i)[0].value = res.data.eduBgs.eduBgStart[i];
                    $('#eduBgEnd0' + i)[0].value = res.data.eduBgs.eduBgEnd[i];
                    $('#eduBgSchool0' + i)[0].value = res.data.eduBgs.eduBgSchool[i];
                    $('#eduBgMajor0' + i)[0].value = res.data.eduBgs.eduBgMajor[i];
                    $('#eduBgAward0' + i)[0].value = res.data.eduBgs.eduBgAward[i];

                    }
                }
                //工作经历
                for (i2 = 1; i2 <= res.data.workHistorys.workCount; i2++) {
                    if($('#workStart0' + i2)[0]){
                    $('#workStart0' + i2)[0].value = res.data.workHistorys.workStart[i2];
                    $('#workEnd0' + i2)[0].value = res.data.workHistorys.workEnd[i2];
                    $('#workComName0' + i2)[0].value = res.data.workHistorys.workComName[i2];
                    $('#workJob0' + i2)[0].value = res.data.workHistorys.workJob[i2];
                    $('#workLeave0' + i2)[0].value = res.data.workHistorys.workLeave[i2];

                    }
                }
                //家庭成员
                for (i3 = 1; i3 <= res.data.familys.familyCount; i3++) {
                    if($('#familyName0' + i3)[0]){
                    $('#familyName0' + i3)[0].value = res.data.familys.familyName[i3];
                    $('#familyCall0' + i3)[0].value = res.data.familys.familyCall[i3];
                    $('#familyCom0' + i3)[0].value = res.data.familys.familyCom[i3];
                    $('#familyContact0' + i3)[0].value = res.data.familys.familyContact[i3];
                    }
                }
                //自我评价
                var comments = res.data.comments;
                var comFeature, comSkill, comHobby, comExpect,
                        businessRadio, skillRadio;
                comFeature = res.data.comments.comFeature ? res.data.comments.comFeature : '';
                comSkill = res.data.comments.comSkill ? res.data.comments.comSkill : '';
                comHobby = res.data.comments.comHobby ? res.data.comments.comHobby : '';
                comExpect = res.data.comments.comExpect ? res.data.comments.comExpect : '';
                businessRadio = comments.businessRadioInput ? comments.businessRadioInput : 0;
                skillRadio = comments.skillRadioInput ? comments.skillRadioInput : 0;
                $('#comFeature')[0].value = comFeature;
                $('#comSkill')[0].value = comSkill;
                $('#comHobby')[0].value = comHobby;
                $('#comExpect')[0].value = comExpect;
                $('#businessRadioInput')[0].value = businessRadio;
                $('#skillRadioInput')[0].value = skillRadio;
                getRadioList(businessRadio, skillRadio);
            },
            error: function () {
                getErrMsg('操作失败！');
            }
        });
    }
    /**
     * 员工资料2选项
     * */
    function getRadioList(business,skill){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        if (userInfo==null || userInfo.token=='undefined') {
            getErrMsg('没有登录！'); return;
        }
        var data = {
            app_access:app_access,
            token:userInfo.token
//            type:userInfo.type,
//            cate:userInfo.cate
        };
        $.ajax({
            type:'post',
            url:getDomain() + 'staff/combyradio',
            data:data,
            success:function(res) {
                //console.log(res); return;
                if (res.code!=0) {
                    console.log(res); return;
                }
                var i, i2, h = '', h2 = '';
                for (i=0;i<res.data.jobTypes.length;i++) {
                    h += '<span class="businessItem">';
                    h += '<label class="businessValue" onclick="setBusinessRadio('+res.data.jobTypes[i].id+')">';
                    h += '<input name="businessTypeCompanyInfo2" type="radio" class="businessCheck"';
                    if (business==res.data.jobTypes[i].id) { h += ' checked'; }
                    h += '/>';
                    h += res.data.jobTypes[i].name;
                    h += '</label>';
                    h += '</span>';
                }
                for (i2=0;i2<res.data.skills.length;i2++) {
                    h2 += '<span class="businessItem">';
                    h2 += '<label class="businessValue" onclick="setSkillRadio('+res.data.skills[i2].id+')">';
                    h2 += '<input name="TechnicalGradeCompanyInfo2" type="radio" class="businessCheck"';
                    if (skill==res.data.skills[i2].id) { h2 += ' checked'; }
                    h2 += '/>';
                    h2 += res.data.skills[i2].name;
                    h2 += '</label>';
                    h2 += '</span>';
                }
                $('#businessRadio').html(h);
                $('#skillRadio').html(h2);
            },
            error:function(){
                console.log('操作失败！'); return;
            }
        });
    }
    /**
     * 设置保存
     * */
    function setSave(){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        if (userInfo==null || userInfo.token=='undefined') {
            getErrMsg('没有登录！'); return;
        }
        if (userInfo.cate!=1 && userInfo.cate!=2) {
            getErrMsg('没有选择员工类型！'); return;
        }
        //获取表单
        var i, i2, i3, eduBgStart = [], eduBgEnd = [],
                eduBgSchool = [], eduBgMajor = [], eduBgAward = [],
                workStart = [], workEnd = [], workComName = [],
                workJob = [], workLeave = [], familyName = [],
                familyCall = [], familyCom = [], familyContact = [],
                comFeature, comSkill, comHobby, comExpect,
                businessRadioInput, skillRadioInput;
        var eduBgCount = $('#eduBgCount').val();
        var workCount = $('#workCount').val();
        var familyCount = $('#familyCount').val();
        for (i=1;i<=eduBgCount;i++) {
            eduBgStart[i] = $('#eduBgStart0'+i).val();
            eduBgEnd[i] = $('#eduBgEnd0'+i).val();
            eduBgSchool[i] = $('#eduBgSchool0'+i).val();
            eduBgMajor[i] = $('#eduBgMajor0'+i).val();
            eduBgAward[i] = $('#eduBgAward0'+i).val();
        }
        for (i2=1;i2<=workCount;i2++) {
            workStart[i2] = $('#workStart0'+i2).val();
            workEnd[i2] = $('#workEnd0'+i2).val();
            workComName[i2] = $('#workComName0'+i2).val();
            workJob[i2] = $('#workJob0'+i2).val();
            workLeave[i2] = $('#workLeave0'+i2).val();
        }
        for (i3=1;i3<=familyCount;i3++) {
            familyName[i3] = $('#familyName0'+i3).val();
            familyCall[i3] = $('#familyCall0'+i3).val();
            familyCom[i3] = $('#familyCom0'+i3).val();
            familyContact[i3] = $('#familyContact0'+i3).val();
        }
        //eduBgStart.splice(0,1);
        comFeature = $('#comFeature').val();
        comSkill = $('#comSkill').val();
        comHobby = $('#comHobby').val();
        comExpect = $('#comExpect').val();
        businessRadioInput = $('#businessRadioInput').val();
        skillRadioInput = $('#skillRadioInput').val();
        var infos = {
            eduBgCount:eduBgCount,
            workCount:workCount,
            familyCount:familyCount,
            //教育背景
            eduBgStart:eduBgStart,
            eduBgEnd:eduBgEnd,
            eduBgSchool:eduBgSchool,
            eduBgMajor:eduBgMajor,
            eduBgAward:eduBgAward,
            //工作经历
            workStart:workStart,
            workEnd:workEnd,
            workComName:workComName,
            workJob:workJob,
            workLeave:workLeave,
            //家庭成员
            familyName:familyName,
            familyCall:familyCall,
            familyCom:familyCom,
            familyContact:familyContact,
            //其他
            comFeature:comFeature,
            comSkill:comSkill,
            comHobby:comHobby,
            comExpect:comExpect,
            businessRadioInput:businessRadioInput,
            skillRadioInput:skillRadioInput
        };
        var formData = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:userInfo.cate,
            staffOptions:infos
        };
//        console.log(formData); return
        //cacheSet('staffOption',infos); //缓存用户可选信息
        $.ajax({
            type:'post',
            url:getDomain() + 'staff/option',
            data:formData,
            success:function(res) {
                //console.log(res); return;
                if (res.code!=0) {
                    getErrMsg(res.msg);
                    console.log(res)
                    return;
                }
                window.location.href = '/h5/login/staffList.html';
            },
            error:function(){
                getErrMsg('操作失败！'); return;
            }
        });
    }
    /**
     * 地址前缀
     * */
    function getDomain(){
        return '/api/member/';
    }
</script>
</html>